package br.trainee.web.componentes;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.BodyTagSupport;

import br.trainee.web.util.ResponseWrapper;

public class TooltipTag extends BodyTagSupport{
	
	
	private String select; 
	
	
	 @Override
	 public int doEndTag() throws JspException {
	 
	String corpo = getBodyContent().getString();	 
		 
		 
	  //PAGECONTEXT É PROTECTED
	  JspWriter saida = pageContext.getOut();
	  HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
	  HttpServletResponse response = (HttpServletResponse) pageContext.getResponse();
	  
	  ResponseWrapper responseWrapper = new ResponseWrapper(response);
	  
	  request.setAttribute("corpo", "CorpoAlboreto");
	  request.setAttribute("nome", "Alboreto");
	  
	  RequestDispatcher req = request.getRequestDispatcher("/resources/componentes/componentes_jsp/tooltip.jsp");
	  
	  try {
	   
	   req.include(request, responseWrapper);
	   
	   String conteudoComponente = responseWrapper.getString();
	   
	   saida.println("Teste para printar na tela");
	   
	  } catch (IOException e1) {
	   
	   e1.printStackTrace();
	   
	  } catch (ServletException e1) {
	   
	   e1.printStackTrace();
	   
	  }  
	  
	  return super.doEndTag();
	 }


	public String getSelect() {
		return select;
	}


	public void setSelect(String select) {
		this.select = select;
	}
	 
	 
	 
}
	